package cn.agiledata.bank.common.util;

import java.util.ArrayList;
import java.util.List;
/**
 * 作者：jj
 * 公司：vnv
 * 功能：
 * 创建日期：2006-04-20
 */
public class PageBean {
	private int totalPage;
	private int previous;
	private int next;
	private int curPage;
	private int length;
	private int totalCount;
	private List data;
	public PageBean(){
	}
	public PageBean(int count,int cur,int pageLength){// count 总记录数; cur 当前页; pageLength 每页记录数
		int pg = (int)Math.ceil(new Double(count).doubleValue()/pageLength);//pg 总页数
        this.setTotalCount(count);
		this.setTotalPage(pg);
		this.setLength(pageLength);
		
		List result = new ArrayList();
		this.setData(result);
		
		if(pg == 0){
			this.setCurPage(0);
		}
		else{
			this.setCurPage(cur);
		}
		if(cur == pg){
			this.setNext(pg);
		}
		else{
			this.setNext(cur + 1);
		}
		if(cur == 1){
			this.setPrevious(1);
		}
		else{
			this.setPrevious(cur - 1);
		}
	}
	
	public int getTotalCount() {
		return totalCount;
	}

	public void setTotalCount(int totalCount) {
		this.totalCount = totalCount;
	}

	public int getCurPage() {
		return curPage;
	}
	public void setCurPage(int curPage) {
		this.curPage = curPage;
	}
	public List getData() {
		return data;
	}
	public void setData(List data) {
		this.data = data;
	}
	public int getNext() {
		return next;
	}
	public void setNext(int next) {
		this.next = next;
	}
	public int getPrevious() {
		return previous;
	}
	public void setPrevious(int previous) {
		this.previous = previous;
	}
	public int getTotalPage() {
		return totalPage;
	}
	public void setTotalPage(int totalPage) {
		this.totalPage = totalPage;
	}
	public int getLength() {
		return length;
	}
	public void setLength(int length) {
		this.length = length;
	}
}
